#include <iostream>
#include <vector>

// 小根堆
class heap {

public:
  heap() = default;
  heap(const std::vector<int> &nums);
  int top();
  void pop();
  bool empty();
  int size();
  void insert(int num);
  friend std::ostream &operator<<(std::ostream &os, const heap &h);

private:
  void siftup(int idx);
  void siftdown(int dix);

private:
  std::vector<int> nums_;
};
